package com.chris.blog.service.impl;

import com.chris.blog.dao.QuestionCategoryDao;
import com.chris.blog.entity.po.QuestionCategoryPO;
import com.chris.blog.service.QuestionCategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class QuestionCategoryServiceImpl implements QuestionCategoryService {

    @Resource
    private QuestionCategoryDao questionCategoryDAO;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return questionCategoryDAO.deleteByPrimaryKey(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insert(QuestionCategoryPO record) {
        return questionCategoryDAO.insert(record);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertSelective(QuestionCategoryPO record) {
        return questionCategoryDAO.insertSelective(record);
    }

    @Override
    public QuestionCategoryPO selectByPrimaryKey(Integer id) {
        return questionCategoryDAO.selectByPrimaryKey(id);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int updateByPrimaryKeySelective(QuestionCategoryPO record) {
        return questionCategoryDAO.updateByPrimaryKeySelective(record);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int updateByPrimaryKey(QuestionCategoryPO record) {
        return questionCategoryDAO.updateByPrimaryKey(record);
    }

    public List<QuestionCategoryPO> selectAll() {
        return questionCategoryDAO.selectAll();
    }
}
